Add a new /proc/xen file called 'capabilities'. Currently, when read in dom0 it will...
authoriap10@freefall.cl.cam.ac.uk <iap10@freefall.cl.cam.ac.uk>
Thu, 1 Dec 2005 01:43:04 +0000 (02:43 +0100)
committeriap10@freefall.cl.cam.ac.uk <iap10@freefall.cl.cam.ac.uk>
Thu, 1 Dec 2005 01:43:04 +0000 (02:43 +0100)
Signed-off-by: ian@xensource.com
linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c

index dff9343c5f94c7248d333bc355641841b45e113c..107f3e8bef2b1290faeb01dce45e8578e3f5791a 100644 (file)
@@ -33,6 +33,7 @@
 #include <asm-xen/xen_proc.h>
 
 static struct proc_dir_entry *privcmd_intf;
+static struct proc_dir_entry *capabilities_intf;
 
 static int privcmd_ioctl(struct inode *inode, struct file *file,
                          unsigned int cmd, unsigned long data)
@@ -234,6 +235,18 @@ static struct file_operations privcmd_file_ops = {
        .mmap  = privcmd_mmap,
 };
 
+static int capabilities_read(char *page, char **start, off_t off,
+                        int count, int *eof, void *data)
+{
+       int len = 0;
+       *page = 0;
+
+       if (xen_start_info->flags & SIF_INITDOMAIN)
+               len = sprintf( page, "control_d\n" );
+
+       *eof = 1;
+       return len;
+}
 
 static int __init privcmd_init(void)
 {
@@ -241,6 +254,10 @@ static int __init privcmd_init(void)
        if (privcmd_intf != NULL)
                privcmd_intf->proc_fops = &privcmd_file_ops;
 
+       capabilities_intf = create_xen_proc_entry("capabilities", 0400 );
+       if (capabilities_intf != NULL)
+               capabilities_intf->read_proc = capabilities_read;
+
        return 0;
 }